package org.osomit.sacct.connector.socket.impl;

import org.osomit.sacct.connector.socket.iface.SocketConnectorProvider;
import org.osomit.sacct.connector.socket.iface.SocketConnector;
import org.osomit.sacct.io.iface.ClientReaderWriter;


/**
 * @author Jian Fang (John.Jian.Fang@gmail.com)
 *
 * Date: Jun 29, 2009
 *
 */
public class SocketConnectorProviderImpl implements SocketConnectorProvider {

    private String serverHost;

    private int serverPort;

    private ClientReaderWriter clientReaderWriter;

    public String getServerHost() {
        return serverHost;
    }

    public void setServerHost(String serverHost) {
        this.serverHost = serverHost;
    }

    public int getServerPort() {
        return serverPort;
    }

    public void setServerPort(int serverPort) {
        this.serverPort = serverPort;
    }

    public ClientReaderWriter getClientReaderWriter() {
        return clientReaderWriter;
    }

    public void setClientReaderWriter(ClientReaderWriter clientReaderWriter) {
        this.clientReaderWriter = clientReaderWriter;
    }

    public SocketConnector getConnector(String serverHost, int serverPort) {
        SocketConnectorImpl connector = new SocketConnectorImpl(serverHost, serverPort);
        connector.setClientReaderWriter(this.clientReaderWriter);
        
        return connector;
    }


    public SocketConnector getConnector() {
        
        return this.getConnector(this.serverHost, this.serverPort);
    }
}
